servo / pathfinder

A fast, practical GPU rasterizer for fonts and vector graphics
Apache License 2.0
3.61k stars 204 forks source link

Better support for WebAssembly #431

Open takkuumi opened 4 years ago

takkuumi commented 4 years ago

First of all, thank you very much!

I am making a web graphics library, and I have tried Fusioncharts, Amcharts, Echarts, G2, D3, etc. I found that they are not the 2D graphics library I want. I want to find a graphics library that can use memory to draw and print to a bitmap buffer. In this way, it can use GPU hardware acceleration or through layering, batch processing to obtain better performance. Finally, no. When I found Pathfinder, wow, this is what I wanted.

However, Pathfinder has some room for improvement in WebAssembly. For example, shrink size, no std support, etc.

I want to know if you have any plans in this regard. Therefore, I can make timely adjustments to my existing products.

Thanks again to Pathfinder and servo project.

(used google translate)

s3bk commented 4 years ago

@NateLing Yes, there are some size issues. A few 100kb can be shaved off by reducing the embedded resources. I don't expect no_std to make a huge difference.

For no_std, the resource loader needs to be split into a crate containing the trait and the implementations, as the FileSystemResourceLoader uses std. No big deal.

leeoniya commented 4 years ago

i've done a lot of benchmarking of charting libraries as part of writing uPlot (shameless plug): https://github.com/leeoniya/uPlot#performance

anything svg-based like d3 degrades quickly with large datasets. amcharts is plain terrible.

it's quite surprising how far you can push Canvas2D if you just avoid per-datapoint memory allocation and keep the GC happy. if you need something like an oscilloscope or waveform display with millions of datapoints at 60fps, then you'll likely need gpu shaders. there are some options in this space as well, in various states of polish:

https://github.com/huww98/TimeChart https://github.com/danchitnis/webgl-plot https://github.com/epezent/implot