Skip to content

ParseJson suddenly very slow #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rachid-adf opened this issue May 18, 2018 · 17 comments
Closed

ParseJson suddenly very slow #96

rachid-adf opened this issue May 18, 2018 · 17 comments

Comments

@rachid-adf
Copy link

rachid-adf commented May 18, 2018

Hello !!!

the sub ParseJson suddenly became very slow in one computer only (a recent one i7-7 Gen), I didn't change anything in the code, 3 minutes for a little json,

after test I noticed that this row of code takes a long time to execute (a couple of second for each iteration) :

json_CopyMemory ByVal json_UnsignedAdd(StrPtr(json_buffer), json_BufferPosition), ByVal StrPtr(json_Append), json_AppendLength

do you have an idea where this comes from?

@rachid-adf rachid-adf changed the title ParseJson very slow ParseJson suddenly very slow May 18, 2018
@counterpoint1
Copy link

counterpoint1 commented May 23, 2018

I believe I now have the exact same problem. It broke my process dependent on this converter. It must be one of these latest Excel 2017 updates that broke this. This is on Windows side.

It appears this pull request addresses the problem. Replaced the code with his code and used the provided clsStringAppend class and all is well again.
#82

@rachid-adf
Copy link
Author

counterpoint1, thank you very much, your solution works very well!

@Locke
Copy link

Locke commented May 29, 2018

Same here: suddenly a drastic performance regression. I could reproduce it on multiple machines running either Windows 10 1803 or 1709.

I also noticed that during the parsing the Windows Defender (MsMpEng.exe) consumes a full CPU (constant 12% on i7), while the CPU usage for WINWORD.exe remained zero.

Applying the mentioned PR resolves the regression.

@rachid-adf
Copy link
Author

@Locke
Copy link

Locke commented May 29, 2018

@rachid-adf That's what I meant with "Applying the mentioned PR resolves the regression" :)

@hlalibe
Copy link

hlalibe commented May 31, 2018

Hi guys,
struggling here, not so familiar with Git
i've downloaded and installed the new JsonConverter.bas file
but now i have an error message on Dim cSA As New clsStringAppend -> Compile error - user defined type not defined.
Any guidance appreciated

@rachid-adf
Copy link
Author

rachid-adf commented May 31, 2018

@hlalibe you have just to add the class clsStringAppend.cls in your project
https://github.com/PGS62/VBA-JSON/blob/master/clsStringAppend.cls

@hlalibe
Copy link

hlalibe commented May 31, 2018

@rachid-adf
thanks Rachid. But how do i do this ? (sorry)
I have the file now , but i don't know what to do with it

@rachid-adf
Copy link
Author

@hlalibe in your project insert a new Class Module from menu and copy the code into

@hlalibe
Copy link

hlalibe commented May 31, 2018

ok got it,
but i had to comment out these 4 first lines to avoid compiling errors
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END

@marcelmueller1978
Copy link

@rachid-adf
Thanks a lot for your solution!

@duncanelliot
Copy link

Hi There,

@rachid-adf @Locke Could you take a look at the link and let me know whether mine is the same problem as yours... I can't quite decide.

VBA-tools/VBA-Web#345

Thanks,

Duncan

@iamanubhavp
Copy link

Hey @rachid-adf, I've been getting "Compile error: Expected: end of statement", while running the class module code you've shared above.
Could you please help me on this ?
Compile Error

@rachid-adf
Copy link
Author

Hi @iamanubhavp, juste delete all text before Option Explicit, and also delete the rows numbers

@iamanubhavp
Copy link

@rachid-adf, I already tried doing that. I think the issue here is with the way I'm running this code. I think I need to import the code .BAS & .cls file.
Is that correct ?

@timhall
Copy link
Member

timhall commented Apr 11, 2019

@iamanubhavp What version of VBA-JSON are you using? The clsStringAppend approach is part of v2.3.0 and later (you can download the latest version here: https://github.com/VBA-tools/VBA-JSON/releases/latest

@iamanubhavp
Copy link

Thanks @timhall , I resolved it by importing .bas & .cls files rather than copy/pasting the code into the modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants