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

hoon: make sane memory-efficient for large atoms #6381

Merged
merged 3 commits into from Mar 13, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 13 additions & 5 deletions pkg/arvo/sys/hoon.hoon
Expand Up @@ -4217,12 +4217,20 @@
$(inx +(inx))
==
|- ^- ?
?: =(0 b) &
=+ cur=(end 3 b)
?: =(inx len) &
=+ cur=(cut 3 [inx 1] b)
?: &((lth cur 32) !=(10 cur)) |
=+ len=(teff cur)
?& |(=(1 len) =+(i=1 |-(|(=(i len) &((gte (cut 3 [i 1] b) 128) $(i +(i)))))))
$(b (rsh [3 len] b))
=+ tef=(teff cur)
?& ?|
=(1 tef)
=+ i=1
|- ?|
=(i tef)
?& (gte (cut 3 [(add i inx) 1] b) 128)
$(i +(i))
== ==
==
$(inx +(inx))
Copy link
Member

Choose a reason for hiding this comment

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

The indentation here is not idiomatic, it should look something like:

=+  tef=(teff cur)
?&  ?|  =(1 tef)
        =+  i=1
        |-  ^-  ?
        ?|  =(i tef)
            ?&  (gte (cut 3 [(add i inx) 1] b) 128)
                $(i +(i))
    ==  ==  ==
  $(inx +(inx))
==

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, thanks. I was getting mixed up with the indent style for ?- and ?+. But shouldn't $(inx +(inx)) be at the same indentation level as the == == ==?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, you're right.

==
::
++ ruth :: biblical sanity
Expand Down