<!DOCTYPE html>
<html>
<head>
<title>Performance / Price for CPUs - Updated <?php print date('M j, Y'filemtime("cpu.json")) ?></title>
<meta property="og:title" content="Performance / Price for CPUs" />
<meta property="fb:admins" content="218471" />

<!--CSS file (default YUI Sam Skin) -->
<link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/2.8.0r4/build/datatable/assets/skins/sam/datatable.css">
<style>
table {
    margin: 0px auto !important;
}
h1 {
    text-align: center;
}
body {
    text-align: center;
    font-family: "Lucida Grande","charcoal cy",arial,sans-serif;
    width: 1000px;
    margin: auto;
}
#geek {
    text-align: left;
}
.help_pay_my_bills {
    float: right;
    padding: 5px;
}
.like {
  margin: 10px;
}
</style>
</head>
<body class="yui-skin-sam">

<h1>Performance / Price for CPUs 
<!--
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fpaulisageek.com%2Fcompare%2Fcpu%2F&amp;layout=button_count&amp;show_faces=true&amp;width=82&amp;action=like&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:82px; height:21px;" allowTransparency="true"></iframe>
-->
</h1>

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http://paulisageek.com/compare/cpu/"></fb:like>

<p>
This site simply takes the data from <a href="http://www.cpubenchmark.net/cpu_list.php">cpubenchmark.net</a>, fetches the current prices from <a href="http://www.tkqlhce.com/click-3775901-10439986">newegg.com</a> and makes a nice table. 

<p>
If the data looks old, <a href="update">start an update</a> - Updated on <?php print date(DATE_RSSfilemtime("cpu.json")) ?>
</p>


<div class="help_pay_my_bills">
<script type="text/javascript"><!--
google_ad_client = "pub-7342863608664054";
/* /compare/cpu */
google_ad_slot = "5502009817";
google_ad_width = 120;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>

<?php
$cpu 
json_decode(file_get_contents("cpu.json"), TRUE);
function 
cmp($a$b) {
    if (!isset(
$a["newegg"]["totalPrice"]) || $a["newegg"]["totalPrice"] == "NaN") return 1;
    if (!isset(
$b["newegg"]["totalPrice"]) || $b["newegg"]["totalPrice"] == "NaN") return -1;

    
$a $a["score"] / $a["newegg"]["totalPrice"];
    
$b $b["score"] / $b["newegg"]["totalPrice"];
    
    return 
$a $b : -1;
}
uasort($cpu'cmp');

?>
<div id="cpucontainer">
<table id="cputable">
<thead>
<tr>
    <th>Name
    <th>Performance
    <th>Price
    <th>Performance / Price
<tbody>
<?php
foreach ($cpu as $row) {
    if (!isset(
$row["newegg"])) continue;
    if (
$row["newegg"]['totalPrice'] == "NaN") continue;
    if (isset(
$_GET['min']) && $row['newegg']['totalPrice'] < $_GET['min']) continue;
    if (isset(
$_GET['max']) && $row['newegg']['totalPrice'] > $_GET['max']) continue;
    
    
$link = <<<END
<a href="{$row["newegg"]["affiliateLink"]}" onmouseover="window.status='{$row["newegg"]["link"]}'" onmouseout="window.status=''">
END;

?>
<tr>
    <td><?php print $link ?><?php print $row["name"?></a>
    <td><a href="http://www.cpubenchmark.net/cpu_lookup.php?cpu=<?php print urlencode($row['name']); ?>"><?php print $row["score"?></a>
    <td><?php print $link ?><?php print $row["newegg"]["totalPrice"?></a>
    <td><?php print number_format(round($row["score"] / $row["newegg"]["totalPrice"], 2), 1); ?>
<?php
}

asort($cpu);
?>
</table>
</div>

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:like class="like" width="800"></fb:like>
<fb:comments href="http://paulisageek.com/compare/cpu/" width="800"></fb:comments>

<br/>

<div id="geek">
For the geeks:
<ul>
<li>
<a href="cpu.json">Raw data</a>
<li>
<a href="http://developer.yahoo.com/yql/console/?q=use%20%22http%3A%2F%2Fpaulisageek.com%2Fyql-tables%2Fnewegg%2Fnewegg.search.xml%22%3B%20SELECT%20*%20FROM%20newegg.search%20WHERE%20query%20%3D%20%27AMD%20Athlon%2064%20X2%20Dual%20Core%205200%2B%27%20and%20category%20%3D%20%2234%22%20and%20order%3D%22BESTMATCH%22">prices from newegg</a> in JSON (via YQL)
<li>
Source for <a href="index.phps">index</a> and <a href="update.phps">update</a>
<li>
If ANYTHING looks wrong, please <a href="mailto:compare-cpu@paulisageek.com">mail me</a>.
<li>
Made by <a href="http://paultarjan.com">Paul Tarjan<a/>.
</div>


<!-- Dependencies -->
<script type="text/javascript" src="http://yui.yahooapis.com/2.8.0r4/build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.8.0r4/build/element/element-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.8.0r4/build/datasource/datasource-min.js"></script>

<!-- Source files -->
<script type="text/javascript" src="http://yui.yahooapis.com/2.8.0r4/build/datatable/datatable-min.js"></script>

<script type="text/javascript">
function sortNumbersWithLinks(a, b, desc, field) {
    a = a.getData(field).replace(/<[^>]+>/, '');
    b = b.getData(field).replace(/<[^>]+>/, '');

    a = parseFloat(a);
    b = parseFloat(b);

    return YAHOO.util.Sort.compare(a, b, desc);
}

var myColumnDefs = [
    {key:"Name", sortable:true},
    {key:"Performance", sortable:true, sortOptions:{sortFunction:sortNumbersWithLinks}},
    {key:"Price", sortable:true, sortOptions:{sortFunction:sortNumbersWithLinks}},
    {key:"Performance / Price", sortable:true, parser:"number"}
];
var myDataSource = new YAHOO.util.DataSource(YAHOO.util.Dom.get("cputable"));
myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
myDataSource.responseSchema = {
    fields: myColumnDefs
};

var myDataTable = new YAHOO.widget.DataTable("cpucontainer", myColumnDefs, myDataSource, {sortedBy:{key:'Performance / Price', dir:'desc'}});
// done in PHP now
// myDataTable.sortColumn(myDataTable.getColumn("Performance / Price"),  YAHOO.widget.DataTable.CLASS_DESC);

var oldColumnDefs = [
    {key:"Name", sortable:true},
    {key:"Performance", sortable:true, parser:"number"}
];
var oldDataSource = new YAHOO.util.DataSource(YAHOO.util.Dom.get("oldtable"));
oldDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
oldDataSource.responseSchema = {
    fields: oldColumnDefs
};
var oldDataTable = new YAHOO.widget.DataTable("oldcontainer", oldColumnDefs, oldDataSource, {sortedBy:{key:'Name', dir:'asc'}});
// Takes too long
// oldDataTable.sortColumn(oldDataTable.getColumn("Name"),  YAHOO.widget.DataTable.CLASS_ASC);

var unknownColumnDefs = [
    {key:"Name", sortable:true},
    {key:"Performance", sortable:true, parser:"number"},
    {key:"Search", sortable:false}
];
var unknownDataSource = new YAHOO.util.DataSource(YAHOO.util.Dom.get("unknowntable"));
unknownDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
unknownDataSource.responseSchema = {
    fields: unknownColumnDefs
};
var unknownDataTable = new YAHOO.widget.DataTable("unknowncontainer", unknownColumnDefs, unknownDataSource, {sortedBy:{key:'Name', dir:'asc'}});
// Takes too long
// unknownDataTable.sortColumn(unknownDataTable.getColumn("Name"),  YAHOO.widget.DataTable.CLASS_ASC);

</script>

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-149816-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

<!-- Start of Woopra Code -->
<script type="text/javascript">
var woo_settings = {idle_timeout:'300000', domain:'paulisageek.com'};
(function(){
 var wsc = document.createElement('script');
 wsc.src = document.location.protocol+'//static.woopra.com/js/woopra.js';
 wsc.type = 'text/javascript';
 wsc.async = true;
 var ssc = document.getElementsByTagName('script')[0];
 ssc.parentNode.insertBefore(wsc, ssc);
 })();
</script>
<!-- End of Woopra Code -->