# How to check \`-O\` optimization flag setting inside script?

**URL:** <https://discourse.julialang.org/t/how-to-check-o-optimization-flag-setting-inside-script/65233>\
**Category:** General Usage\
**Created:** [July 24, 2021, 1:16pm UTC](https://discourse.julialang.org/t/how-to-check-o-optimization-flag-setting-inside-script/65233 "2021-07-24T13:16:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnomotani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnomotani/32/26753_2.png) [@johnomotani](https://discourse.julialang.org/u/johnomotani)\
**Post date:** [July 24, 2021, 1:16pm UTC](https://discourse.julialang.org/t/how-to-check-o-optimization-flag-setting-inside-script/65233/1 "2021-07-24T13:16:49Z")

</div>

I’m writing a script to run a performance benchmark. I’d like to add a check that Julia is running with full optimization (i.e. `-O3`) to ensure the results are representative. Is there a way to get the `-O` optimization flag setting from within a script?

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [July 24, 2021, 2:02pm UTC](https://discourse.julialang.org/t/how-to-check-o-optimization-flag-setting-inside-script/65233/2 "2021-07-24T14:02:08Z")

</div>

`Base.JLOptions().opt_level` but I’m really sure what “to ensure the results are representative” means.

---

<div class="post-metadata">

**Author:** ![johnomotani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnomotani/32/26753_2.png) [@johnomotani](https://discourse.julialang.org/u/johnomotani)\
**Post date:** [July 24, 2021, 2:05pm UTC](https://discourse.julialang.org/t/how-to-check-o-optimization-flag-setting-inside-script/65233/3 "2021-07-24T14:05:01Z")

</div>

Thanks @giordano!

Sorry, by “to ensure the results are representative” I just meant that I want to always run with `-O3`, because I’ll save the results from many runs, so they should all have used `-O3` to be comparable.
