question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The Be() method does not allow a becauseArgsFunc parameter

See original GitHub issue

Description

The Be() method should allow a becauseArgsFunc parameter. This function callback creates and returns the becauseArgs parameter list. This will improve performance of apps that use this method.

Example: In my app, I need to create a large becauseArgs parameter list. This is expensive. Especially since I assert in my inner most loop in my app, many times per second. This ends up slowing down my app significantly. I wish I could not evaluate becauseArgs unless the assertion fails. So only if the assertion fails, will Be() call the becauseArgsFunc to get the actual becauseArgs.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dennisdoomencommented, Jul 4, 2022

We do some performance benchmarking on certain important operations like BeEquivalentTo. But for the rest, unless somebody complains, we don’t.

In your case, the ask would be a big investment that we’re not willing to make right now.

1reaction
dennisdoomencommented, Jun 13, 2022

Sure you can, but it wasn’t designed for that, so it may have consequences on the performance.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Can not use Func with parameters
I have an example for my problem. Basically i need to pass a method to another method with parameters included. public void test()...
Read more >
Using Python Optional Arguments When Defining Functions
In this tutorial, you'll learn about Python optional arguments and how to define functions with default values. You'll also learn how to create...
Read more >
Python args and kwargs: Demystified
my_sum() takes all the parameters that are provided in the input and packs them all into a single iterable object named args ....
Read more >
The arguments object - JavaScript - MDN Web Docs - Mozilla
arguments is an array-like object accessible inside functions that contains the values of the arguments passed to that function.
Read more >
5 Types of Arguments in Python Function Definitions
Learn about the five different types of arguments used in python function definitions: default, keyword, positional, arbitrary positional ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found