Skip to content
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

WIP: Allow users to use an external zlib-ng #393

Merged
merged 4 commits into from
Apr 13, 2022

Conversation

hmaarrfk
Copy link
Contributor

@hmaarrfk hmaarrfk commented Apr 10, 2022

This supersedes the previous PR that allowed users to use an external ZLIB-NG.

I think it works because it is less invasive.

  • Works with internal zlib-ng
  • Works with external zlib-ng
  • Works with external zlib
  • Graceful fallback to built in zlib

#include "zlib.h"
#else
#include "zlib-ng.h"
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By selecting "zlib-ng.h" you are introducing yet another format to Blosc2, which is not what we'd like to do. We have chosen zlib-ng as a modern implementation of zlib, but that was always meant to be run in ZLIB_COMPAT mode. What we want is to use the external zlib-ng, but in ZLIB_COMPAT mode. Is that possible?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To my knowledge, compat mode allows zlibng to export the same symbols as zlib. That is, in addition to the new symbols.

Without compat mode, you have to prefix the functions with zng_

Remains the version identifier. Maybe that one is wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I'm not too sure what the goal of using zlib-ng, but restricting yourself to the zlib compression/decrompression. You are likely considering a use-case I am not.

In my mind, if you do want the speedups of zlib-ng, you might as well use the new form of the function calls??? I might also be mis-interpretting what ZLIB_COMPAT means. My ultimate understanding is that they didn't change the compression format, but rather sped up the implementation.

Is that not true?

Do you think that data compressed with zng_compress2 will not be able to be opened with decompress from vanila zlib?

@FrancescAlted
Copy link
Member

Oops, it looks like I was wrong and zlib-ng is meant to always produce bit streams that are compatible with the original zlib project: zlib-ng/zlib-ng#905. Sorry about the confusion.

With that, I am happy with this PR. If it is this ready to be merged, I will gladly do so :-)

clibversion = ZLIB_VERSION;
#elif defined(HAVE_ZLIB_NG)
clibversion = ZLIBNG_VERSION;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the return value of clib version get saved in the file?

Zlibng version will be in the 2.x.x while zlib version. 1.x.x which may be an important change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And potentially b undesirable

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question. Maybe @nmoinvaz can shed some light here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ups, sorry, clibversion is only used for blosc_get_complib_info() to get the versions of internal codecs, so not stored in the file. With that, I think we are safe merging that.

@FrancescAlted FrancescAlted merged commit 8c4e51e into Blosc:main Apr 13, 2022
@FrancescAlted
Copy link
Member

All done. Thanks @hmaarrfk !

@hmaarrfk
Copy link
Contributor Author

Thanks for this!

@hmaarrfk
Copy link
Contributor Author

#358 might also provide insights as to why things aren't working here

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

Successfully merging this pull request may close these issues.

2 participants