Skip to content

Conversation

ringabout
Copy link
Member

@ringabout ringabout commented Aug 22, 2024

It speeds up

proc foo =
  let piece = cast[seq[char]](newSeqUninit[uint8](5220600386'i64))

foo()

Notes that cast[ref](...) is excluded because we need to keep the ref alive if the parameter is something with pointer types (e.g. cast[ref](pointer)or cast[ref](makePointer(...)))

@ringabout ringabout marked this pull request as draft August 22, 2024 12:28
@ringabout ringabout marked this pull request as ready for review August 23, 2024 11:23
@Araq Araq merged commit 4ef06a5 into devel Aug 23, 2024
@Araq Araq deleted the pr_cast_sink branch August 23, 2024 18:07
Copy link
Contributor

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from 4ef06a5

Hint: mm: orc; opt: speed; options: -d:release
173638 lines; 8.216s; 654.516MiB peakmem

narimiran pushed a commit that referenced this pull request Sep 13, 2024
It speeds up
```nim
proc foo =
  let piece = cast[seq[char]](newSeqUninit[uint8](5220600386'i64))

foo()
```

Notes that `cast[ref](...)` is excluded because we need to keep the ref
alive if the parameter is something with pointer types (e.g.
`cast[ref](pointer)`or `cast[ref](makePointer(...))`)

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
(cherry picked from commit 4ef06a5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants