[Gambas-user] Can JSON.Decode be faster?

Cristiano Guadagnino criguada at gmail.com
Sat Jan 20 14:20:46 CET 2018


They are completely different beasts... A gosub translates to a simple jump
to another address in assembler code, there's no overhead at all.
A function on the other hand has it's own private variables, so during the
call you need to save the state of the calling routine and then you have to
maintain the stack.
These are the first things that come to mind, but there may be more.

Cris


On Sat, Jan 20, 2018 at 9:51 AM, Fabien Bodard <gambas.fr at gmail.com> wrote:

> Hi, Benoit... I don't really understand why using std function call is
> so slower than Gosub calls :-/
>
> 2018-01-18 18:33 GMT+01:00 Patrik Karlsson <patrik at trixon.se>:
> > 2018-01-18 2:05 GMT+01:00 Benoît Minisini <g4mba5 at gmail.com>:
> >>
> >> Le 18/01/2018 à 01:05, Benoît Minisini a écrit :
> >>>
> >>> 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?
> >>>
> >>>
> >>
> >> You can test the commit
> >> https://gitlab.com/gambas/gambas/commit/4ff9f7ddef726e3957c30bf31b794b
> 894b88d914
> >> to check the speed up of the JSON.Decode() routine.
> >>
> >> ...and the default null margin for ImageView.ZoomFit() too.
> >>
> >> Regards,
> >>
> >>
> >> --
> >> Benoît Minisini
> >>
> >
> > Thank you, it's blazing fast now!
> > About 100 times faster. :)
> >
> > 01/18/2018 19:27:54.043 load json
> > 01/18/2018 19:27:54.044 decode json
> > 01/18/2018 19:27:54.367 getBase64
> > 01/18/2018 19:27:54.367 loadImage
> > 01/18/2018 19:27:54.397 done
> >
> > The null margin is much appreciated, so is  the sdl2 tweak.
> >
> > /Patrik
> >
> >
> > --------------------------------------------------
> >
> > This is the Gambas Mailing List
> > https://lists.gambas-basic.org/listinfo/user
> >
> > Hosted by https://www.hostsharing.net
> >
>
>
>
> --
> Fabien Bodard
>
> --------------------------------------------------
>
> This is the Gambas Mailing List
> https://lists.gambas-basic.org/listinfo/user
>
> Hosted by https://www.hostsharing.net
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180120/3fb5a185/attachment.html>


More information about the User mailing list