为什么= javascript_include_tag" // www.google.com/jsapi"在localhost上加载速度很慢?

时间:2015-12-06 00:58:26

标签: javascript ruby-on-rails performance google-api

当我尝试使用groupdate gem使用Chartkick gem显示图表时,对于只有3行的表来说速度非常慢。这是来自控制台。加载页面需要22秒!

  Tracking Load (1.0ms)  SELECT "trackings".* FROM "trackings" WHERE "trackings"."user_id" = $1 AND "trackings"."tracking_category_id" = $2  [["user_id", 1], ["tracking_category_id", 5]]
  Rendered trackings/new.haml within layouts/application (22045.5ms)

当我评论=javascript_include_tag "//www.google.com/jsapi"时,它加载速度非常快(虽然有错误)。

=javascript_include_tag "//www.google.com/jsapi"
=javascript_include_tag "chartkick"

HTML

<script src="//www.google.com/jsapi"></script>
<script src="/assets/chartkick.self-767a86f502825bd83be8240c9952f03a972f3c42d4c4ccfdb42b6070c5348479.js?body=1"></script>
<h1>Track My Progress</h1>

https://github.com/ankane/chartkick#installation

1 个答案:

答案 0 :(得分:0)

我能够通过对协议进行硬编码来加快速度,但我仍然不知道为什么它很慢。它认为它是文件路径还是什么?

=javascript_include_tag "https://www.google.com/jsapi"