A case for a fast trip count predictor

•A fast heuristic to predict the trip count of loops.•The heuristic predicts correctly the majority of the loops in SPEC 2006.•The heuristic is O(1).•The heuristic allows us to invoke the Firefox JIT compiler earlier.•The heuristics speeds up some JavaScript benchmarks by 5% to 27% in Firefox. The T...

Full description

Saved in:
Bibliographic Details
Published inInformation processing letters Vol. 115; no. 2; pp. 146 - 150
Main Authors Alves, Péricles R.O., Rodrigues, Raphael E., de Sousa, Rafael Martins, Quintão Pereira, Fernando Magno
Format Journal Article
LanguageEnglish
Published Amsterdam Elsevier B.V 01.02.2015
Elsevier Sequoia S.A
Subjects
Online AccessGet full text

Cover

Loading…
More Information
Summary:•A fast heuristic to predict the trip count of loops.•The heuristic predicts correctly the majority of the loops in SPEC 2006.•The heuristic is O(1).•The heuristic allows us to invoke the Firefox JIT compiler earlier.•The heuristics speeds up some JavaScript benchmarks by 5% to 27% in Firefox. The Trip Count of a loop determines how many iterations this loop performs. Predicting this value is important for several compiler optimizations, which yield greater benefits for large trip counts, and are either innocuous or detrimental for small ones. However, finding an exact prediction, in general, is an undecidable problem. Such problems are usually approached via methods which tend to be computationally expensive. In this paper we make a case for a cheap trip count prediction heuristic, which is O(1) on the size of the loop. We argue that our technique is useful to just-in-time compilers. If we predict that a loop will iterate for a long time, then we invoke the JIT compiler earlier. Even though straightforward, our observation is novel. We show how this idea speeds up JavaScript programs, by implementing it in Mozilla Firefox. We can apply our heuristic in 79.9% of the loops found in typical JavaScript benchmarks. For these loops, we obtain exact predictions in 91% of cases. We get similar results when analyzing the C programs of SPEC CPU 2006. A more elaborate technique, linear on the size of the loop, improves our O(1) technique only marginally. As a consequence of this work, we have been able to speed up several JavaScript programs by over 5%, reaching 24% of improvement in one benchmark.
Bibliography:ObjectType-Article-1
SourceType-Scholarly Journals-1
ObjectType-Feature-2
content type line 23
ISSN:0020-0190
1872-6119
DOI:10.1016/j.ipl.2014.08.008