performance.now和Date.now

相同点

首先都能够返回当前时间

不同点

1. performance.now:是浏览器(Web API)提供的方法,不同浏览器获取到的精度不同。                1. Date.now:是Javascript内置方法,差异主要在于浏览器遵循的ECMAScript规范。

2.performance.now()精确点高,不依靠系统时间,但是兼容性有问题。适用于高进度需求的场景,比如作为一个基准点或则游戏、音频、视频等所需精度很高的地方。

2.Date.now()会受系统时间影响,且以Unix(ˈjuːnɪks)时间为基准,不易看懂,无兼容性问题。会因为系统时间的变化而改变,准确性有时不能保证,通用性比较高。

3.Date.now()返回的时间戳没有被限制在一毫秒的精确度内,小于 1ms 的测试不出来结果。

3.performance.now():返回的时间戳以双精度浮点数 double 的形式表示时间,精度最高可达微秒级。

Date.now() 约等于 performance.timing.navigationStart + performance.now()

例子

let start = Date.now();
// 调用一个耗时间的循环
for (let i = 0; i < 100000; i++) {
  let doSomething = i * i;
}
let end = Date.now()

// 从格兰威特时间到至今(循环开始前)的时间戳
console.log('开始时间:', start);	// 1666781986873
console.log('结束时间:', end);		// 1666781986873
// 以毫秒计的运行时长
console.log('运行时长:',end - start)	// 0 毫秒
let start = performance.now();
// 调用一个耗时间的循环
for (let i = 0; i < 100000; i++) {
  let doSomething = i * i;
}
let end = performance.now()

// 返回的时间戳,是自创建上下文以来经过的时间,跟打开网页的时间有关,但是这不是绝对的。
// 如果返回的值是178764.00000002384185791 这类的,这种的会被处理为 178764
console.log('开始时间:', start);	// 178764
console.log('结束时间:', end);		// 178764.10000002384
// 以毫秒计的运行时长
console.log('运行时长:',end - start)	// 0.10000002384185791 毫秒

  • 7
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
====================================================================== Microsoft(R) Product Support Services Application Note (Text File) WV1160: VIDEO 1.1E FOR WINDOWS(R) RUN-TIME EDITION ====================================================================== Revision Date: 3/95 1 Disk Included The following information applies to Microsoft Video for Windows, version 1.1e. --------------------------------------------------------------------- | INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY | | ACCOMPANY THIS DOCUMENT (collectively referred to as an Application | | Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER | | EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED | | WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR | | PURPOSE. The user assumes the entire risk as to the accuracy and | | the use of this Application Note. This Application Note may be | | copied and distributed subject to the following conditions: 1) All | | text must be copied without modification and all pages must be | | included; 2) If software is included, all files on the disk(s) | | must be copied without modification (the MS-DOS(R) utility | | diskcopy is appropriate for this purpose); 3) All components of | | this Application Note must be distributed together; and 4) This | | Application Note may not be distributed for profit. | | | | | | Copyright (C) 1995 Microsoft Corporation. All Rights Reserved. | | Microsoft, MS-DOS and Windows are registered trademarks of | | Microsoft Corporation. | | NetWare is a registered trademark of Novell, Inc. | --------------------------------------------------------------------- INTRODUCTION ------------ The WV1160 disk included with this Application Note contains an updated run-time version of Microsoft Video for Windows. Video 1.1e for Windows retains all the improvements that were included in version 1.1d of Video for Windows, but does not include the low-level driver code that was licensed from Intel Corporation. SPECIFIC FILES UPDATED IN VERSION 1.1E -------------------------------------- The following files are changed in version 1.1e: Filename Description -------------------------------------------------------------- DCISVGA.DRV This file is removed if it is found in your Windows\SYSTEM subdirectory. MSVIDEO.DLL This file contains support for additional display adapters. PREVIOUS IMPROVEMENTS TO VIDEO FOR WINDOWS ------------------------------------------ - Improved palette support. The new version of MSVIDEO.DLL and the Cinepak and Indeo codecs prevent Video for Windows from having to dither 24-bit videos twice during playback. - Display Control Interface (DCI) support. DCI allows Video for Windows to provide faster and smoother playback on video adapters that use the S3, Cirrus Logic, or any one of several other chip sets. Video for Windows now supports all DCI-enabled video adapters. The performance of stretched and clipped videos is also much improved for all video adapters. - Better overall performance. - Improved simultaneous playback of two .AVI files. - Improved playback of loosely interleaved or noninterleaved files with NetWare(R) Video. - Improved performance of video playback, correcting a problem that caused shaky playback. - The compression algorithm was changed to meet the official Interactive Multimedia Association adaptive-differential-pulse-code- modulation (ADPCM) format specification fully. - A general protection (GP) fault problem was corrected. This problem occurred when you clicked embedded Video 1.1 for Windows media objects in OLE 2.0 clients. - A slight memory leak that occurred with embedded objects was corrected. INSTALLING VIDEO 1.1E FOR WINDOWS RUN-TIME EDITION -------------------------------------------------- 1. If you received a disk with this Application Note, insert the disk in the appropriate floppy disk drive. If you downloaded this Application Note from an online service, skip to step 2. This procedure assumes that you have already downloaded and extracted the compressed file. 2. From the Program Manager File menu, choose Run. In the Command Line box, type the following line and then press ENTER <source>:\setup where <source> is either the letter of your floppy disk drive or the directory containing the file you downloaded from online services. For example, if you are installing from a floppy disk that you inserted in drive A: a:\setup Or, for example, if you downloaded the WV1160.EXE file from online services to C:\DOWNLOAD: c:\download\setup 3. Follow the instructions in the Setup program to finish installing Video 1.1e for Windows.
9.3.1 Monitoring and Fixing Errors ...............................350 9.3.2 Alex King’s 404 Notifier Plugin .....................................................351 9.3.3 Broken Link Checker Plugin ........................................................351 9.3.4 Other Error-Logging Techniques .................................................352 9.3.5 Online Monitoring Services ........................................................352 9.4.1 Staying Current with WordPress .........................355 9.4.2 Updating WordPress .................................................................355 9.4.3 Logging Changes ....................................................................356 9.4.4 Backing Up Your Database and Files ..............................................357 9.5.1 Optimizing WordPress ...........................................358 9.5.2 Content and File Caching ..........................................................359 9.5.3 File Compression Methods ........................................................360 9.5.4 Optimizing CSS and JavaScript ...................................................362 9.5.5 Reducing the Number of HTTP Requests .......................................363 9.5.6 Plugin Maintenance .................................................................368 9.5.7 Database Maintenance ..............................................................369 9.5.8 Other Optimization Techniques ..................................................368 Contents 1 Welcome to WordPress 1.1.1 Welcome ........................................................................9 1.1.2 Why WordPress is Amazing ............................................................9 1.1.3. How to Setup and Configure WordPress .........................................10 1.1.4 How to Implement Advanced Functionality .....................................10 1.1.5 How to Optimize and Secure WordPress .........................................10 1.1.6 How to Maintain Your WordPress Site .............................................11 1.1.7 Don’t Worry ..............................................................................12 1.2.1 So, You’ve Never Heard of WordPress ..................12 1.2.2 One Template, Many Pages ..........................................................13 1.2.3 Powerful, Flexible and Extensible ...................................................14 1.3.1 Key Components of a WordPress Site ..................15 1.3.2 WordPress Core Files ..................................................................15 1.3.3 The WordPress Database .............................................................15 1.3.4 The Back End ............................................................................17 1.3.5 The Front End ...........................................................................17 1.4.1 Tools of the Trade ......................................................18 1.4.2 A Domain Name ........................................................................18 1.4.3 Web Host / Server ......................................................................18 1.4.4 Text / Code Editor ......................................................................19 1.4.5 FTP Program .............................................................................19 2 Setting Up WordPress 2.1.1 The Famous Five Minute Install .............................23 2.1.2 Where To Install? .......................................................................23 2.1.3 Checking Default Performance .....................................................24 2.2.1 OK, I’m In. Now What? .............................................25 2.2.2 Just Publish Something! .............................................................25 2.2.3 Go Look At It! ...........................................................................25 2.2.4 The Plan ..................................................................................26 2.3.1 Permalinks: Your URL Structure ............................26 2.3.2 HTAccess .................................................................................27 2.3.3 Which Style of Permalinks? ..........................................................28 2.3.4 Pick One and Stick With It ...........................................................29 2.3.5 SEO Consideration: Mind Your Post “Slugs” ......................................29 2.4.1 Categories and Tags .................................................30 2.4.2 They Are Basically the Same ........................................................32 2.4.3 Use Only One Category Per Post ...................................................32 2.4.4 Use Multiple Tags Per Post ..........................................................33 2.4.5 Don’t Go Overboard! ..................................................................33 2.4.6 You Don’t Need to Use Them At All ...............................................34 2.4.7 Custom Taxonomies ..................................................................34 2.5.1 Users and Administrators ........................................37 2.5.2 Add a New Account for Yourself ...................................................39 2.6.1 Choosing the Perfect Theme .................................40 2.6.2 Where to Find Awesome Themes..................................................40 2.6.3 Previewing Themes ...................................................................41 2.6.4 Key Things to Look For in a Theme ...............................................41 2.7.1 Getting Started with Plugins ...................................44 2.7.2 Installing and Activating Plugins ....................................................44 2.7.3 Difference Between Disabling and Uninstalling .................................45 2.7.4 Recommended Plugins ...............................................................46 3 Anatomy of a WordPress Theme 3.1.1 Understanding Theme Files ....................................51 3.1.2 Every Theme is Different .............................................................51 3.1.3 Commonly Used Theme Files .......................................................53 3.1.4 How Theme Files Work Together...................................................54 3.2.1 Understanding Different Page Views ...................54 3.2.2 Page Views are for Pages .............................................................55 3.2.3 Single Views are for Posts ............................................................55 3.2.4 The Many Faces of Archive Views .................................................56 3.2.5 Which File Renders What? ............................................................57 3.3.1 Kicking It Off with the Header ...............................58 3.3.2 The DOCTYPE and HTML Attributes ..............................................58 3.3.3 META Elements .........................................................................59 3.3.4 The Title ..................................................................................59 3.3.5 Link Elements ...........................................................................61 3.3.6 The wp_head() Function .............................................................64 3.3.7 Template Tags ...........................................................................65 3.4.1 The WordPress Loop .................................................67 3.4.2 The Loop in Plain English ............................................................68 3.4.3 The Loop Just Knows .................................................................69 3.4.4 Some Common “Loop Only” Functions ..........................................70 3.4.5 Some Common “Outside Loop” Functions .......................................71 3.5.1 Comments ....................................................................71 3.5.2 The comments.php File ..............................................................71 3.5.3 Selective Inclusion for Different Views ............................................72 3.6.1 The Sidebar .................................................................74 3.6.2 Purpose and Placement ..............................................................74 3.6.3 Popular Sidebar Functions ...........................................................75 3.6.4 Widgets, Widgets, Widgets ...........................................................78 3.7.1 The Search Form ........................................................79 3.7.2 Why is This a Separate File? ..........................................................79 3.7.3 Alternatives to WordPress Search ...................................................80 3.8.1 The Footer ...................................................................81 3.8.2 The wp_footer() Hook ................................................................81 3.8.3 Mini Footers / Mega Footers .........................................................82 3.9.1 Theme Functions .......................................................83 3.9.2 Functions are for Specific Themes .................................................83 3.9.3 Advantage Over Core Hacks ........................................................84 4 Theme Design and Development 4.1.1 Customizing the Loop ..............................................87 4.1.2 The Loop Doesn’t Care About Markup ............................................88 4.1.3 The Power of query_posts ...........................................................90 4.1.4 Displaying Different Numbers of Posts ............................................91 4.1.5 Excluding Specific Categories .......................................................91 4.1.6 Changing the Sort Order .............................................................92 4.1.7 Show Specific Pages, Embed a Page within a Page ............................92 4.1.8 Using Multiple Loops ..................................................................92 4.2.1 Sidebars and Footers ................................................96 4.2.2 Multiple Sidebars .......................................................................96 4.3.1 Menus, Archive Lists & Tag Clouds .......................99 4.3.2 Page-Specific Menu Styles ..........................................................101 4.3.3 Create the Perfect Archives Page ..................................................103 4.3.4 Impress Your Visitors with a Tag Cloud .........................................105 4.4.1 Side Content and Useful Menu Items ................105 4.4.2 Displaying Recent Comments .....................................................106 4.4.3 Displaying Recent Posts .............................................................107 4.4.4. Listing Popular Posts .................................................................108 4.4.5 Listing Recently Modified Posts ....................................................109 4.4.6 Listing Random Posts ................................................................110 4.4.7 Import and Display Twitter .........................................................110 4.4.8 Import and Display Delicious ......................................................113 4.4.9 Import and Display Other Content ...............................................114 4.5.1 Creating and Using Child Themes .....................117 4.6.1 Styling Your Theme ................................................118 4.6.2 Different Inclusion Methods ........................................................119 4.6.3 To Reset or Not To Reset? ..........................................................120 4.6.4 Basic CSS Optimization ..............................................................121 4.7.1 Using Multiple Themes ...........................................123 4.8.1 Widgetizing ...............................................................126 5 Extending Functionality 5.1.1 Extensibility ...............................................................131 5.1.2 Extending WordPress with Plugins ................................................131 5.1.3 A Plugin for (Almost) Everything ..................................................131 5.1.4 Do You Need a Plugin? ...............................................................135 5.1.5 Choosing the Perfect Plugin ........................................................136 5.2.1 Plugin Usage and Maintenance ..........................138 5.2.2 Sequential Installation ...............................................................138 5.2.3 Keep Plugins Up-To-Date ...........................................................138 5.2.4 Subscribe to Plugin Comment Threads .........................................139 5.2.5 Getting Help with Plugins ...........................................................140 5.2.6 Diagnosing Plugin Conflicts ........................................................140 5.2.7 Disabling and Uninstalling Plugins ................................................141 5.2.8 Share Your Experience with Others ...............................................143 5.3.1 Extending with Custom Functions .....................144 5.3.2 Plugins vs. Theme Functions .......................................................145 5.3.3 Useful Examples of Theme Functions ............................................146 5.3.4 Example #1: Easy Admin Buttons for Comments .............................146 5.3.5 Example #2: Sitewide Shortcode Functionality ................................147 5.3.6 Example #3: Transferring Plugins to functions.php ...........................149 5.3.7 Example #4: Transferring Functions to a Plugin ..............................150 5.4.1 Other Ways to Extend Functionality ..................151 5.4.2 Functions Within Theme Files .....................................................151 5.4.3 Hacking the WordPress Core .......................................................153 5.5.1 WordPress as a CMS ................................................154 5.5.2 CMS Features Built Into WordPress ...............................................154 5.5.3 Working With Custom Fields .......................................................155 5.5.4 Users, Roles and Permissions ......................................................160 5.5.5 Categorizing, Tagging, and Custom Taxonomies .............................161 5.5.6 Page Templates ........................................................................162 5.5.7 Page, Category, and Tag Heirarchies .............................................163 5.5.8 Dynamic Menus .......................................................................165 5.6.1 Extending CMS Functionality ...............................166 5.6.2 CMS-Related Plugins .................................................................166 5.6.3 Using WordPress as a Forum .......................................................171 5.6.4 Integration with Third-Party Forum Applications .............................172 5.6.5 Multiple Blogs with WordPress MU ...............................................173 6 Working with RSS Feeds 6.1.1 Working with RSS Feeds ........................................177 6.1.2 Quick Introduction to Feeds ........................................................177 6.1.3 Dynamic Publishing and Content Distribution .................................177 6.1.4 The Pros and Cons of Delivering RSS Feeds ....................................178 6.2.1 Different Types of WordPress Feeds ...................178 6.2.2 Posts Feed .............................................................................180 6.2.3 Comments Feed ......................................................................180 6.2.4 Individual Post Comments Feed ..................................................181 6.2.5 Category and Tag Feeds ............................................................181 6.2.6 Other Feed Types .....................................................................182 6.3.1 Feed Configurations and Formats ......................183 6.3.2 Full Feeds ...............................................................................185 6.3.3 Partial Feeds ............................................................................186 6.3.4 Number of Posts ......................................................................186 6.3.5 WordPress Feed Formats ............................................................187 6.4.1 Using FeedBurner For Feed Delivery .................190 6.4.2 Benefits of Using FeedBurner ......................................................190 6.4.3 Setting Up and Configuring a FeedBurner Account ..........................192 6.4.4 Redirecting to FeedBurner via Plugin ............................................192 6.4.5 - Redirecting to FeedBurner via HTAccess ......................................193 6.4.6 Redirecting to FeedBurner via PHP ...............................................195 6.5.1 Tracking and Displaying Statistics ......................197 6.5.2 Types of Statistics Provided by FeedBurner .....................................197 6.5.3 Displaying FeedBurner Statistics ..................................................198 6.5.4 Alternatives to FeedBurner .........................................................199 6.6.1 Customizing Feeds .................................................201 6.6.2 Formatting Feed Images ...........................................................203 6.6.3 Adding a Custom Feed Image ....................................................204 6.6.4 Include Comments in Feeds ......................................................206 6.6.5 Creating Custom Feeds.............................................................208 6.6.6 More Feed Customization Tricks ..................................................212 6.6.7 Styling Feeds ...........................................................................213 6.6.8 Removing the WordPress Version Number .....................................213 6.6.9 Disable and Redirect Unwanted Feed Formats ................................215 6.6.10 Insert Custom Content into Feeds ..............................................216 6.6.11 Importing and Displaying External Feeds ......................................218 6.6.12 Buffer Period After Posting ........................................................219 6.6.13 Protecting Feed Content ...........................................................221 6.7.1 Validating Feeds .......................................................223 6.7.2 Diagnosing and Troubleshooting Errors ........................................224 7 Working with Comments 7.1.1 Optimizing the Comments Area ..........................227 7.1.2 Welcome to the WordPress Comments Area ..................................228 7.1.3 About the WordPress Comment System ........................................228 7.1.4 Comments, Pingbacks and Trackbacks ..........................................227 7.1.5 Anatomy of the WordPress Comment Area ....................................229 7.2.1 Syndicating Comments 7.2.2 WordPress Main Comments Feed .................................................233 7.2.3 Post-Specific Comment Feeds ....................................................234 7.3.1 Formatting the Comments Area ..........................235 7.3.2 Using wp_list_comments() or a Custom Loop? ................................237 7.3.3 Implementing Paged Comments .................................................243 7.3.4 Implementing Threaded Comments ............................................245 7.3.5 Separating comments, pingbacks and trackbacks ............................249 7.3.6 Eliminating Pingbacks and Trackbacks ..........................................252 7.3.7 Control Directly with the Database ...............................................255 7.4.1 Customizing Comment Display ...........................256 7.4.2 Numbering Comments Globally and Locally ..................................256 7.4.3 Alternating Comment Styles .......................................................260 7.4.4 Custom Styles for Authors and Members ........................................261 7.4.5 Styling Comments with Gravatars ................................................263 7.4.6 Add a Message ........................................................................265 7.4.7 Moderation Links in the Theme Itself ............................................267 7.4.8 Display Comment, Ping/Trackback Counts ....................................268 7.5.1 Optimizing the Comment Form ..........................269 7.5.2 Setup Comment Previews .........................................................269 7.5.3 Rich-Text Editors for Comments ..................................................270 7.5.4 Adding Comment Quicktags ......................................................272 7.5.5 Comment Management and Spam Prevention ................................274 7.6.1 Controlling Comment Spam .................................274 7.6.2 WordPress’ Built-In Anti-Spam Functionality ..................................275 7.6.3 Anti-Spam Plugins for WordPress .................................................276 7.7.1 Other Considerations & Techniques ...................278 7.7.2 Enhancing and Encouraging Comments .......................................278 7.7.3 “nofollow” Links ........................................................................279 7.7.4 Integrating Twitter ....................................................................282 8 Search Engine Optimization 8.1.1 SEO Strengths and Weaknesses .........................285 8.1.2 Strong Focus on Content ..........................................................285 8.1.3 Built-In “nofollow” Comment Links ..............................................286 8.1.4 Duplicate Content Issues ...........................................................286 8.2.1 Controlling Duplicate Content ............................287 8.2.2 Meta noindex and nofollow Tags ................................................288 8.2.3 Nofollow attributes ...................................................................291 8.2.4 Robots.txt Directives ................................................................293 8.2.5 Canonical Meta Tags .................................................................297 8.2.6 Use Excerpts for Posts ..............................................................299 8.3.1 Optimizing Permalink Structure .........................300 8.3.2 Default URLs vs. “Pretty” Permalinks .............................................300 8.3.3 Keep Permalinks Short ...............................................................301 8.3.4 Maximize Permalink Keywords ...................................................303 8.4.1 Scoring with Google ...............................................305 8.4.2 Content, Content, Content ........................................................305 8.4.3 Detecting Duplicate Content ......................................................305 8.4.4 Optimizing Heading Elements .....................................................307 8.4.5 Optimizing Title Tags ...............................................................308 8.4.6 The nofollow Wars ....................................................................310 8.4.7 Fixing Broken Links ...................................................................310 8.4.8 Using a Sitemap .......................................................................312 8.4.9 Other SEO tips .........................................................................313 8.4.10 SEO-Related plugins ................................................................314 8.5.1 Tracking the Success of Your Site .......................316 8.5.2 Statistical WordPress plugins .......................................................316 8.5.3 Shaun Inman’s Mint Stats ...........................................................317 8.5.4 Google Analytics ......................................................................318 8.5.5 Other Metrics ..........................................................................319 8.6.1 Closing Thoughts on SEO .....................................320 9 Maintaining a Healthy Site 9.1.1 Keeping a Site Healthy ...........................................323 9.1.2 Securing WordPress ...................................................................323 9.1.3 Setting Secure File Permissions ...................................................324 9.1.4 Disabling Directory Views ..........................................................326 9.1.5 Forbid Access to Sensitive Files ...................................................328 9.1.6 Neuter the Default “admin” User Account .......................................339 9.1.7 Remove the WordPress Version Number .......................................340 9.1.8 Securing Your Database .............................................................341 9.1.9 Secure Multiple Installations .......................................................344 9.1.10 Prevent Hotlinking ..................................................................344 9.1.11 More WordPress Security Help ...................................................345 9.2.1 Stopping Comment Spam ....................................346 9.2.2 Configuring Your WordPress Admin Options...................................347 9.2.3 Using the Built-In Comment Moderation ......................................348 9.2.4 Using the Built-In Comment Blacklist ...........................................348 9.2.5 Disabling Comments on Old Posts ..............................................349 9.2.6 Deny Access to No-Referrer Requests ..........................................349

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值