Hacker News new | past | comments | ask | show | jobs | submit login

You have access to GPU hardware in web frontends, through WebGL. It’s faster, also more power efficient.



I was thinking that svg would get you better browser support, but it turns out it just gets you IE9/10 and Opera Mini. Which might be important for business apps, but I guess not for everyone:

https://caniuse.com/#feat=webgl

https://caniuse.com/#feat=svg

I am interested at where it would be an advantage (if at all) to use SVG over OpenGL on the front end or server?


I know little about modern web development, but I think WebGL is way more efficient on clients.

Even on mobiles, GPUs have much more computing power. They have architecture designed for transforming vertices and computing lightning, very fast and highly parallel.

In best case, SVG will take input triangles and submit them to GPU. Very small overhead (slightly more GPU bandwidth because lightning, when it’s that simple, bandwidth is often more expensive than compute). But in worst case, SVGs will rasterize on CPU, very slow in comparison.

If you rasterize on the server e.g. send jpeg images to browser, it becomes complicated, and depends on many factors like scene complexity and server hardware. Rasterizing triangles is much cheaper on GPU, but JPEG compressor needs data in system RAM not in VRAM, need to download back, relatively slow. Also on many public clouds virtual GPUs are expensive.


Is it really more power-efficient? CPUs are often a smaller process node than integrated GPUs and it's much easier to share common work between pixels with CPU rendering, reducing redundant operations.


> Is it really more power-efficient?

I would expect huge difference for similar operations. Current-gen $300 GPU consumes 120W doing 4.6 TFlops. Current-gen $300 CPU consumes 65 W doing 16 flop/cycle * 3.6 GHz * 8 cores = 0.4 GFlops. GPU cores don't spend electricity minimizing latency e.g. predicting branches, and they work at much lower frequencies.

Also some parts of the pipeline are implemented in hardware (rasterizer, texture units, alpha blending, Z buffer), they don't cost flops and hardware implementation is likely even more efficient than shader cores. E.g. if you want a gradient, load/compute per-vertex colors and the rasterizer will interpolate in hardware.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: