Questions tagged [prefetch]

A technique to minimize time spent waiting for some needed data to arrive, effectively hiding the latency of the fetch or part of it. Examples include instruction and data prefetching in microprocessors, and link prefetching in html browsers.

Prefetching is a technique to minimize time spent waiting for some needed data to arrive, either externally by the user or internally by the system. If the target of the request (whether a memory address, or a web link) can be predicted well enough in advance, a prefetch dispatched early will have time to fetch the data before the actual demand, thereby hiding the latency of the demand itself when it arrives. As the prefetch may arrive even earlier than needed, prefetching is often associated with caching mechanisms. Examples include instruction and data prefetching in microprocessors (both software based and hardware prefeching), link prefetching in html browsers, and database prefetching mechanisms.

522 questions
102
votes
2 answers

Why does django's prefetch_related() only work with all() and not filter()?

suppose I have this model: class PhotoAlbum(models.Model): title = models.CharField(max_length=128) author = models.CharField(max_length=128) class Photo(models.Model): album = models.ForeignKey('PhotoAlbum') format =…
Timmmm
  • 88,195
  • 71
  • 364
  • 509
72
votes
5 answers

Prefetching Examples?

Can anyone give an example or a link to an example which uses __builtin_prefetch in GCC (or just the asm instruction prefetcht0 in general) to gain a substantial performance advantage? In particular, I'd like the example to meet the following…
Shaun Harker
  • 853
  • 1
  • 7
  • 8
67
votes
4 answers

What are the differences between html preload and prefetch?

Preload and prefetch are both used to request resources in advance so that later resource loading can be quick. It seems that I can interchange the two without…
golopot
  • 10,726
  • 6
  • 37
  • 51
55
votes
2 answers

Do current x86 architectures support non-temporal loads (from "normal" memory)?

I am aware of multiple questions on this topic, however, I haven't seen any clear answers nor any benchmark measurements. I thus created a simple program that works with two arrays of integers. The first array a is very large (64 MB) and the second…
Daniel Langr
  • 22,196
  • 3
  • 50
  • 93
46
votes
4 answers

How do I programmatically disable hardware prefetching?

I would like to programmatically disable hardware prefetching. From Optimizing Application Performance on Intel® Core™ Microarchitecture Using Hardware-Implemented Prefetchers and How to Choose between Hardware and Software Prefetch on 32-Bit…
Carlos
  • 1,455
  • 2
  • 14
  • 15
41
votes
2 answers

How to prefetch data using a custom python function in tensorflow

I am trying to prefetch training data to hide I/O latency. I would like to write custom Python code that loads data from disk and preprocesses the data (e.g. by adding a context window). In other words, one thread does data preprocessing and the…
read Read
  • 5,765
  • 4
  • 29
  • 30
32
votes
9 answers

Extract target from Tensorflow PrefetchDataset

I am still learning tensorflow and keras, and I suspect this question has a very easy answer I'm just missing due to lack of familiarity. I have a PrefetchDataset object: > print(tf_test) $
jda
  • 506
  • 1
  • 4
  • 15
31
votes
1 answer

What are _mm_prefetch() locality hints?

The intrinsics guide says only this much about void _mm_prefetch (char const* p, int i) : Fetch the line of data from memory that contains address p to a location in the cache heirarchy specified by the locality hint i. Could you list the…
Serge Rogatch
  • 13,865
  • 7
  • 86
  • 158
27
votes
2 answers

Does software prefetching allocate a Line Fill Buffer (LFB)?

I've realized that Little's Law limits how fast data can be transferred at a given latency and with a given level of concurrency. If you want to transfer something faster, you either need larger transfers, more transfers "in flight", or lower…
Nathan Kurz
  • 1,649
  • 1
  • 14
  • 28
21
votes
3 answers

How do you test the effects of dns-prefetch and preconnect

I'm trying out the and tags and I'm trying to see whether they help for my site. I can't find any online resources about how verify if these hints are working using browser dev tools, extensions, or…
webbower
  • 756
  • 1
  • 7
  • 21
21
votes
3 answers

The prefetch instruction

It appears the general logic for prefetch usage is that prefetch can be added, provided the code is busy in processing until the prefetch instruction completes its operation. But, it seems that if too much of prefetch instructions are used, then it…
Karthik Balaguru
  • 7,424
  • 7
  • 48
  • 65
20
votes
2 answers

DNS prefetching of subdomains

Do I have to prefetch a subdomain separately? E.g. when I have do I need an additional tag for //static.example.com as well?
damian
  • 5,314
  • 5
  • 34
  • 63
19
votes
1 answer

Tensorflow Data API - prefetch

I am trying to use new features of TF, namely Data API, and I am not sure how prefetch works. In the code below def dataset_input_fn(...) dataset = tf.data.TFRecordDataset(filenames, compression_type="ZLIB") dataset = dataset.map(lambda…
MPękalski
  • 6,873
  • 4
  • 26
  • 36
19
votes
2 answers

Can link prefetch be used to cache a JSON API response for a later XHR request?

Given a JSON API endpoint /api/config, we're trying to use in the head of an HTML document. Chrome downloads the data as expected when it hits the link tag in the HTML, but requests it again via XHR from our…
bsa
  • 2,671
  • 21
  • 31
19
votes
1 answer

Prefetched resources are loaded twice

I want to use html prefetch to prefetch a font file. I followed the recommendations here: https://css-tricks.com/prefetching-preloading-prebrowsing/
000
  • 26,951
  • 10
  • 71
  • 101
1
2 3
34 35