Questions tagged [deferred-execution]
219 questions
2
votes
1 answer
Task Chaining with Cursor issue on app engine. Exception: Too big query offset. Anyone else get this issue?
I'm not sure if anyone else has this problem, but I'm getting an exception "Too big query offset" when using a cursor for chaining tasks on appengine development server (not sure if it happens on live).
The error occurs when requesting a cursor…

Rob Curtis
- 2,245
- 24
- 33
2
votes
3 answers
garbage collection in a linq query
I have a question about how garbage collection might be handled in a linq query.
Suppose I am given a list of requests to process. Each request generates a very large set of data, but then a filter is applied to only keep critical data from each…

tbischel
- 6,337
- 11
- 51
- 73
2
votes
1 answer
Underscorejs 'defer' (or setTimeout 1) not working consistently
In a large-scale JavaScript application I have a similar case like this:
var $box = $('#box');
var expensiveOperation = function () {
for (var i = 0; i < 10000; i++) {
for (var j = 0; j < 4500; j++) {
Math.random();
…

skay-
- 1,546
- 3
- 16
- 26
2
votes
2 answers
How can I evaluate a deferred Linq statement when debugging?
I'm debugging in VS2010, and I want to inspect a string value but all I can get the debugger to show me (through watches, hovering, locals, etc.) is:
"System.Linq.Enumerable+d__3a`1[System.Char]"
I don't care if there are side…

DanO
- 2,526
- 2
- 32
- 38
2
votes
3 answers
LINQ - IEnumerable.ToList() and Deferred Execution confusion
I have an IEnumerable variable named "query" which represents an entity framework query. If I do the following, will it enumerate the query more than once? My confusion is in "result" being an IEnumerable and not a List.
IEnumerable result =…

Bumper
- 367
- 6
- 17
2
votes
1 answer
Why can't a Deferred be passed to a callback in Python Twisted?
d = Deferred()
d.callback(Deferred()) # Assertion error saying that a Deferred shouldn't be passed
Why is this? I looked through the code and commit messages / Trac and see no reason why this should be the case. The most obvious way to bypass this…

Oliver Zheng
- 7,831
- 8
- 53
- 59
2
votes
1 answer
IEnumerable Has Results Until Count() Or Any() Are Called
I'm performance testing variations on Linq extension methods, and I came across an odd situation.
When execution returns to the test, calling Count() first will return 1, and subsequent Any() is false.
When calling Any() first, it is true and…

Chris Kissinger
- 181
- 1
- 11
2
votes
1 answer
Stung by using Linq deferred execution with async/await
I am new to async/await and am tinkering with it to execute an operation on a list of objects using a list of tasks. I used Linq to generate both the list of objects and the list of tasks. The example below looks a little contrived, but it is a…

Darryl
- 1,531
- 15
- 26
2
votes
1 answer
Rails 3 - how to defer parsing of JavaScript
I am trying to optimize my website and one of the suggestions I got was to defer parsing of JavaScript. I have googled it for a couple of hours but I haven't come across an elegant solution to do this in Rails 3. I am using the standard
<%=…

Snels Nick
- 925
- 3
- 13
- 25
2
votes
2 answers
Does this extension method efficiently materialize my IQueryable?
So I recently discovered that you can force Entity Framework not to translate your projection into SQL by specifying a Func to the .Select() extension method rather than an expression. This is useful when you want to transform your…

Terence Lewis
- 904
- 12
- 22
1
vote
1 answer
load scripts asynchronosly and have a fallback
My objective here is to load scripts asynchronously when the browser supports defer or async.
If the browser supports neither I don't care about asynchronous loading (not my bad).
I want to make sure that any script is only executed when the…

brunoais
- 6,258
- 8
- 39
- 59
1
vote
2 answers
Measure elapsed time with a defer statement in Go
I thought of using the defer statement to measure the elapsed time of a program in Go:
func main() {
start := time.Now()
defer fmt.Println(fmt.Sprintf("The process took %s", time.Now().Sub(start)))
...
}
I thought this would produce the…

Stefan Zhelyazkov
- 2,599
- 4
- 16
- 41
1
vote
1 answer
Fine-grained control of deferred execution when implementing IQueryable
I am implementing IQueryable, and so far have only implemented an expression visitor for 'Where' calls and everything else is currently unsupported. The expression is translated into native T-SQL. I plan on adding support for additional method calls…

Sean Thoman
- 7,429
- 6
- 56
- 103
1
vote
2 answers
Defer, return and Argument evaluation in golang
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
a, b := 0, 1
return func() int {
defer func() {a, b = b, a + b}()
return a
}
}
func…

likecs
- 353
- 2
- 13
1
vote
1 answer
Why should I call os.Exit at most once in the main function?
I started a new job and we've been instructed to use Ubers Go coding standards. I'm not sure about one of their guidelines entitled "Exit Once":
If possible, prefer to call os.Exit or log.Fatal at most once in your main(). If there are multiple…

NimaKapoor
- 119
- 6