Skip to content

Don't build debug strings when factory debug: false#20

Open
thetamind wants to merge 1 commit intoblunt-elixir:reorgfrom
thetamind:factory-build-debug-strings-when-needed
Open

Don't build debug strings when factory debug: false#20
thetamind wants to merge 1 commit intoblunt-elixir:reorgfrom
thetamind:factory-build-debug-strings-when-needed

Conversation

@thetamind
Copy link
Copy Markdown

This commit adds earlier debug: true checks so log_value/5 and debug/2 avoid building messages only to be discarded later.

I was profiling my tests and saw building debug strings took up a bit of the time building factory values.

  Blunt.Data.Factories.Factory.build/1                              66     189.897       0.470  <--
    Blunt.Data.Factories.Factory.build_final_message/1              66     127.517       0.134     
    Blunt.Data.Factories.Factory.evaluate_values/1                  66      25.472       0.264     
    Blunt.Data.Factories.Factory.init_builder/1                     66      23.806       0.266     
    Blunt.Data.Factories.Factory.normalize/1                        66       8.454       0.943     
    Blunt.Data.Factories.Factory.debug/2                           132       4.178       0.529  

  Blunt.Data.Factories.Value.Blunt.Data.Factories.Values.Pro       192      21.930       0.756  <--
    Blunt.Data.Factories.Factory.log_value/5                       175       9.170       0.703     
    Faker.Company.name/0                                            13       3.678       0.065     

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

Successfully merging this pull request may close these issues.

1 participant