Store/retrieve Object to/from file

Get help with using AutoHotkey and its commands and hotkeys
toralf
Posts: 584
Joined: 27 Apr 2014, 21:08
Location: Germany

Store/retrieve Object to/from file

18 Jul 2018, 22:34

I would like to store data from an object to a file and retrieve it later. I do not care of the format of the file, nor if it is human readable.

To get an overview of different approaches i wanted to ask for your suggestions of existing scripts that have this ability.
I would like to compare the code and approaches to select the right for my use case.
Please give a hint towards scripts that write/read their object content to/from a file.
Many thanks in advance.

Features I am looking for are:
- time to write
- time to read
- ability to partially update the file (nice to have)
- file size

PS: has someone already done such a comparison?
ciao
toralf
toralf
Posts: 584
Joined: 27 Apr 2014, 21:08
Location: Germany

Re: Store/retrieve Object to/from file

20 Jul 2018, 01:21

Thanks a lot for the reference.
That is what I was looking for. Is there a way to compress the binary data during dump and uncompressed while load?
ciao
toralf
Helgef
Posts: 3721
Joined: 17 Jul 2016, 01:02
Contact:

Re: Store/retrieve Object to/from file

20 Jul 2018, 01:46

Hello.
I do not know, maybe ask HotKeyIt.

Cheers.
toralf
Posts: 584
Joined: 27 Apr 2014, 21:08
Location: Germany

Re: Store/retrieve Object to/from file

21 Jul 2018, 00:55

EvilC, thank you for the reference.
I’m curious, why do you think ObjDump/Load is overkill?
As a user it seems that using both is nearly identical. It is only to include them and have one command to write it and one to read the data. Even the commands are nearly identical in terms of parameters.
ciao
toralf
toralf
Posts: 584
Joined: 27 Apr 2014, 21:08
Location: Germany

Re: Store/retrieve Object to/from file

23 Jul 2018, 16:50

I have tried 3 different ways to store the object,
1) with ObjDump
2) with JSON
3) with JSON and VarZ

The filesizes are (for a currently tiny object):
1) 6113 Bytes 100%
2) 2633 bytes 43%
3) 1905 Bytes 31%

Compressing the file with 7zip as .7z or .zip, lead to these filesizes
1) 1450/1730 bytes 24%/28%
2) 2011/2038 bytes 33%/33%
3) 1265/1354 bytes 21%/22%

I have not measured the speed or cpu usage of it yet, since the object isn't large yet.

But I'll go with 3), since it gives already a 69% reduction in filesize without extra file compression (which would at max just add another 10% reduction compared to ObjDump [or 34% relatively to the original filesize of 3)]).

Thank y'all for your support
ciao
toralf
User avatar
evilC
Posts: 4690
Joined: 27 Feb 2014, 12:30

Re: Store/retrieve Object to/from file

23 Jul 2018, 18:17

From what I understand, ObjDump is dumping methods etc too (ie dump a class instance etc) and it sounded like all you want is a data transport format, hence my comment about ObjDump being overkill

Return to “Ask For Help”

Who is online

Users browsing this forum: asad41163, Bing [Bot], flyingDman, MIRKOSOFT, Monoxide3009, NoReplayNoRewind and 106 guests