almosr / android-svg-code-render

Convert SVG files into Java source and use it in your Android app
Apache License 2.0
24 stars 3 forks source link

Speed Improvements with kXML #36

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
We are using svg-android-2 in the mapsforge project.
But with a main change, the use of the kXML library which speeds up SVG parsing 
considerably, compared with the SAX version.

I have tried also androidsvg which seems to use SAX.
Though it could render more svg files, it's slower than above implementation.

Have you considered using a faster SVG parser like the kXML?

Original issue reported on code.google.com by devemu...@gmail.com on 11 Jun 2014 at 8:02

GoogleCodeExporter commented 9 years ago
I did some experiments for the current unreleased version. I tried a pull 
parser and it didn't really make any real difference to parse times.

I did however optimise a few things and the parser is a lot faster now (>2X).  
The biggest improvement came from implementing a custom float parser.  The new 
number parser is around 6X faster than the standard one in Java/Android.

I may do some testing with kXML and see whether it does offer a significant 
improvement. 

What speed difference are you seeing between your version of svg-android and 
AndroidSVG parsing-wise?

Original comment by paul.leb...@gmail.com on 11 Jun 2014 at 11:49

GoogleCodeExporter commented 9 years ago
Thanks for the feedback.

If you want to see better what I mean, you can try Cruiser (an Android map 
application using mapsforge).
http://wiki.openstreetmap.org/wiki/Cruiser
You'll need also a vector map from
http://download.mapsforge.org/
Zoom in at street level inside a city and you'll see the rendered svg POI.

If I compare side by side our map viewer using svg-android-2 (kXML) and 
androidsvg,
I see that there is notable delay at svg rendering with androidsvg, specially 
at areas where there are plenty of svg symbols.
We experienced that kind of delay when we tried the svg-android-2 with its 
original SAX parser.

If you want I can try any beta version of androidsvg to test its performance.

Original comment by devemu...@gmail.com on 12 Jun 2014 at 7:19

GoogleCodeExporter commented 9 years ago
Thanks for the offer to do some beta testing.

I've uploaded a beta version of 1.2.2 to the downloads page.  It should also be 
available on the maven central repository soon.

androidsvg-1.2.2-beta-1.jar

Obviously AndroidSVG will probably never be as fast as svg-android for many 
reasons.  In order to properly render all files, there are things it has to do 
that make it slower.

Original comment by paul.leb...@gmail.com on 16 Jun 2014 at 7:45

GoogleCodeExporter commented 9 years ago
I try androidsvg-1.2.2-beta-1 as svg parser for mapsforge in Cruiser Beta:
https://play.google.com/store/apps/details?id=gr.talent.cruiser.beta

Have you included at your latest beta version any performance improvements?

Original comment by devemu...@gmail.com on 19 Jun 2014 at 10:26

GoogleCodeExporter commented 9 years ago
Yes. 1.2.2 has a bunch of parsing speed improvements.  So you didn't notice any 
difference?

Original comment by paul.leb...@gmail.com on 19 Jun 2014 at 12:48

GoogleCodeExporter commented 9 years ago
Yes, I think there is performance improvement (I asked to be sure).

Is in your plans to try also the kXML?

Thanks for publishing the beta version also on Maven.

Original comment by devemu...@gmail.com on 19 Jun 2014 at 4:55