octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #60625] jsondecode: Exponential overhead when


From: anonymous
Subject: [Octave-bug-tracker] [bug #60625] jsondecode: Exponential overhead when parsing array of arrays
Date: Tue, 18 May 2021 03:18:53 -0400 (EDT)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Safari/605.1.15

URL:
  <https://savannah.gnu.org/bugs/?60625>

                 Summary: jsondecode: Exponential overhead when parsing array
of arrays
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Tue 18 May 2021 07:18:52 AM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Performance
                  Status: None
             Assigned to: None
         Originator Name: Simon Geisseler
        Originator Email: geisseler@plexim.com
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: Any

    _______________________________________________________

Details:

Test script:

str_small = fileread('testdata_small.json');
str_medium = fileread('testdata_medium.json');

disp('--- Small:');
tic;
data_small = jsondecode(str_small);
toc;
disp(size(data_small));

disp('--- Medium:');
tic;
data_medium = jsondecode(str_medium);
toc;
disp(size(data_medium));


Output:

--- Small:
Elapsed time is 0.076982 seconds.
     10   5001
--- Medium:
Elapsed time is 5.87995 seconds.
      10   50001


The attached patch fixes the problem and produces linear overhead when
reordering the elements.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Tue 18 May 2021 07:18:52 AM UTC  Name: testdata_small.json  Size: 715KiB
  By: None

<http://savannah.gnu.org/bugs/download.php?file_id=51450>
-------------------------------------------------------
Date: Tue 18 May 2021 07:18:52 AM UTC  Name: jsondecode_performance.patch 
Size: 849B   By: None

<http://savannah.gnu.org/bugs/download.php?file_id=51451>

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60625>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]