[Gambas-user] Can JSON.Decode be faster?
Benoît Minisini
g4mba5 at gmail.com
Thu Jan 18 01:05:34 CET 2018
Le 17/01/2018 à 21:27, Patrik Karlsson a écrit :
> In this little project: https://github.com/trixon/gambas-idg (contains a
> json file, requires Gambas=3.10.90 c1e4b89 (master))
>
> I'm decoding a json string around 1MB and it takes 30 seconds in Gambas.
> CPU: Quad core Intel Core i7-6700HQ (-MT-MCP-) cache: 6144 KB
> clock speeds: max: 3500 MHz 1: 800 MHz 2: 800 MHz 3: 800 MHz
> 4: 800 MHz 5: 800 MHz 6: 800 MHz
> 7: 800 MHz 8: 800 MHz
>
> When doing it in java with Google Gson it takes virtually no time at all.
>
> I intend to use this in an image viewer that consumes base64 encoded
> photos wrapped in a json among its exif data.
> Could this be done faster in Gambas?
The JSON.Decode() is not really optimized, so I think it can be made faster.
By the way, it's not a good idea to use JSON for big binary data.
>
> I guess I could split the base64 from the json but it would be nice to
> have it atomic.
>
> Sidenote 1:
> Should not Now() for 01/17/2018 21:47:57.73 be 01/17/2018 21:47:57.730
> with a zero at the end?
This is the standard Gambas format, read the Format$() documentation
about dates.
> 01/17/2018 21:47:28.687 load json
> 01/17/2018 21:47:28.687 decode json
> 01/17/2018 21:47:57.699 getBase64
> 01/17/2018 21:47:57.699 loadImage
> 01/17/2018 21:47:57.73 done
>
> Sidenote 2:
> How do I get rid of that margin around the ImageView?
> It's very visible in fullscreen mode but it's there in normal mode too.
> When I shrink the window size so that the scroll bars are about to
> appear, the margin gets away, but then the image is too small to watch.
It comes from the ZoomFit() method. Maybe this method should takes the
margin as an optional argument?
>
> /Patrik
>
>
>
> --------------------------------------------------
>
> This is the Gambas Mailing List
> https://lists.gambas-basic.org/listinfo/user
>
> Hosted by https://www.hostsharing.net
>
--
Benoît Minisini
More information about the User
mailing list