# Is there any optimization for constants?

**URL:** <https://forum.crystal-lang.org/t/is-there-any-optimization-for-constants/5341>\
**Category:** Help & Support\
**Created:** [February 8, 2023, 11:10am UTC](https://forum.crystal-lang.org/t/is-there-any-optimization-for-constants/5341 "2023-02-08T11:10:13Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![straight-shoota](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/straight-shoota/32/36_2.png) [@straight-shoota](https://forum.crystal-lang.org/u/straight-shoota)\
**Post date:** [February 9, 2023, 11:56am UTC](https://forum.crystal-lang.org/t/is-there-any-optimization-for-constants/5341/11 "2023-02-09T11:56:12Z")

</div>

This seems to be a bug. Apparently, when you take a pointer of a constant the `once_init` guard loses track of the initialization status.

Reduced reproduction:

```crystal
Foo = begin
  puts "Initializing Foo"
end

pointerof(Foo)

```

This prints “Initializing Foo” twice.

---

_[View the full topic](https://forum.crystal-lang.org/t/is-there-any-optimization-for-constants/5341)._
