abapmerge icon indicating copy to clipboard operation
abapmerge copied to clipboard

ABAP minifier

Open larshp opened this issue 9 years ago • 5 comments

As noted in https://github.com/larshp/abapGit/pull/467 the "compiled" version of abapGit is getting quite large.

As a joke I suggested writing a ABAP minifier, but perhaps it is not totally stupid?

Wonder how much the source code can be reduced if:

  • Empty new lines are removed
  • Comments are removed
  • Indentation is removed

guess this would be a new project in some language that can run on travis(javascript?)

larshp avatar Nov 27 '16 11:11 larshp

Couldn't the abapMerge do this? Something like abapmerge --minify

eduardocopat avatar Nov 28 '16 15:11 eduardocopat

yeah

larshp avatar Nov 28 '16 16:11 larshp

I wrote a minifier for abapmerge (See: https://github.com/Sirius-A/abapmerge)

Results

Normal ABAPGit:    1.31 MB (1375246 Bytes)
Minified AbapGit:   848 KB  (868582 Bytes)

-->minified version is around 60% of its normal size.

Note: I did not not test the minified code on a SAP system yet. I'll PR when I made sure it works.

Sirius-A avatar Feb 25 '17 15:02 Sirius-A

did some testing, it seems like the editor and/or abap parser is not very happy with the very long 1 line of code.

perhaps try adding newline(at appropriate places) after each 1000 bytes

UPDATE: it looks like the editor automatically splits after 255 bytes image

larshp avatar Feb 26 '17 08:02 larshp

One thing to consider might be that there are legacy function modules which read the uncompiled source code from the database and analyze it line by line with a line variable typed as CHAR80 which causes a dump if there is any line longer than 80 characters. I would not bother trying to support that, just so you know.

fabianlupa avatar Feb 26 '17 12:02 fabianlupa