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

Size #1

Open
notoria opened this issue Dec 9, 2023 · 5 comments
Open

Size #1

notoria opened this issue Dec 9, 2023 · 5 comments

Comments

@notoria
Copy link
Owner

notoria commented Dec 9, 2023

Hello @UWN, what do you think of an implementation of Prolog such that:

?- N is 2^23, length(Es, N), Es = _.
   error(resource_error(memory),length/2).
?- N is 2^16, findall(A, (between(0, N, I), number_chars(I, Cs), atom_chars(A, Cs)), As), As = _.
   error(resource_error(atom),atom_chars/2).

Is the implementation too limited? Are there implementations with similar limitations?

What I really want to know is if extremely small implementations are faster than "normal" implementations? I'm assuming they are using the same techniques.

SWI-Prolog is an example where it's possible to compare 32 bits version and 64 bits version. I would like to find other implementations.

@UWN
Copy link

UWN commented Dec 11, 2023

In the meantime, SICStus no longer offers the 32-bit implementation for Linux.

The only good reason why I liked 32-bit implementations (some time ago) was that they could not use so much memory and were better for testing overflow handling producing resource_error/1, my specialty.

As for the atom table capacity, I hope that Scryer will fix partial strings (voir mthom#1714) , and then, atoms are practically never needed.

Is speed really that important, that you are willing to trade it for space?

BTW, which implementation are you using that shows throw(...) for a standard error?

@notoria
Copy link
Owner Author

notoria commented Dec 11, 2023

Is speed really that important, that you are willing to trade it for space?

Speed is nice but I'm more thinking of an embedded environment or game (where lua is used). I don't use that much memory in Prolog and I don't know how big the dataset used in Prolog are. But I'm also intrigued by the question of whether it would be very fast and/or could be useful.

For text processing it wouldn't be useful since there are 1114112 Unicode code point (that many atoms of length 1). But I don't know for the heap limitation how it would limit its usage.

BTW, which implementation are you using that shows throw(...) for a standard error?

The implementation doesn't exist but it's what would have happen.

@UWN
Copy link

UWN commented Dec 13, 2023

And why not error/2, to make it a tiny bit more readable? (And offering a corresponding definition for it)

@notoria
Copy link
Owner Author

notoria commented Dec 13, 2023

It's the toplevel and I'm not there yet.

@UWN
Copy link

UWN commented Dec 14, 2023

error/2 would be a predicate in a library.

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

2 participants