循环编译器优化(Loop compiler optimization)
我需要优化大量使用linq的大型应用程序。 许多linq语句在linq扩展方法中创建匿名对象。 一个例子 :-
// custom sort order var sortedData = data.OrderBy(x => (new List<string>() {"Orange", "Apple", "Pear" }).IndexOf(x.Name)); foreach (var d in sortedData) { ....
问题是每个迭代都会创建一个新的List。
是否有一个编译器标志可以让编译器进行一些静态分析并将循环不变代码提取到循环之外?
I have a need to optimize a large apps that use linq extensively. Many of the linq statements create anonymous objects within the linq extension methods. An example :-
// custom sort order var sortedData = data.OrderBy(x => (new List<string>() {"Orange", "Apple", "Pear" }).IndexOf(x.Name)); foreach (var d in sortedData) { ....
The problem is that a new List gets created for every iteration.
Is there a compiler flag I can set to get the compiler to do some static analysis and extract the loop invariant code to be outside of the loop?
原文:https://stackoverflow.com/questions/13861756
更新时间:2023-06-11 09:06
最满意答案
相关问答
更多-
尝试不在表名使用变量: $liveposts = $wpdb->get_results( $wpdb->prepare("SELECT * FROM wp_bus_route WHERE post_status = 'publish'") ); Try to not using variables at table names: $liveposts = $wpdb->get_results( $wpdb->prepare("SELECT * FROM wp_bus_route WHERE post_ ...
-
Wordpress ajax做的有点不同! 您向ajax处理程序添加一个操作,并使用中央ajax处理程序作为url。 在大多数主题中它是js var ajaxurl。 如果它没有定义谷歌它。 注意:我没有检查你的数据库功能 HTML:WordPress定义了一个名为wpdb的类,它包含一组用于与数据库交互的函数。 $ wpdb的参考链接 如果你想检查表wp_form_subscribe的电子邮件 $status=''; if(isset($_POST['submit'])) { global $wpdb; $tablename = 'wp_form_subscribe'; $email = esc_sql($_POST['email']); // Exec ...您可以避免在php中使用isset将空白数据提交到wordpress表中 if(!empty($_POST['streamname'])) { // the code } 看到这一个..希望它有用 You can avoid submitting blank data into the wordpress table by using isset in php if(!empty($_POST['streamname'])) { // the code } See this one ..Hope i ...
WordPress中的自定义表单并将值存储到自定义数据库中(Custom form in WordPress and store values into custom database)[2022-01-03]
你可以通过下面的代码来完成它: query( $wpdb->prepare("INSERT INTO wp_test_form ( field1, fi ...如果您想使用php,请尝试以下教程: https : //www.w3schools.com/php/php_ref_mysqli.asp 如果您正在开发wordpress插件,请查看wordpress codex: https : //codex.wordpress.org/Creating_Tables_with_Plugins 这将需要您的一些研究。 祝你好运! If you want to use php, try this tutorial: https://www.w3schools.com/p ...如何在wordpress上集成自定义表单并添加/编辑/删除(How to integrate a custom form and add/edit/delete on wordpress)[2021-07-06]
有些插件允许您创建自定义表单( cformsII ),并且通过一些额外的PHP知识,您可以使用其API检索数据。 我发现本教程可以快速安装,配置和检索此插件中的数据 。 该页面还列出了一些值得关注的其他表单插件。 另一种选择是使用HTML和PHP来实现,而无需使用插件。 以下链接将为您提供有关如何启动的一些信息以及可以帮助您入门的一些代码: http://www.paulmc.org/whatithink/2009/02/05/using-wordpress-templates-to-create-form ...如何从自定义mysql数据库中自动导入wordpress内容?(How to auto import wordpress contents from custom mysql database?)[2022-08-22]
我认为最简单的方法是将数据库导出到csv文件,然后使用csv import插件之一。 另一种方法是从数据库中获取数据作为数组,然后运行foreach循环并为每一行创建一个帖子。 I think the easiest was is to export database to csv file and then use one of csv import plugins. Alternative way is to fetch data from the database as array and then ...听起来您的主要问题是没有考虑目录结构的问题。 尝试使用来引用验证码。 要在所有页面上包含mail.php ,请将其移至主题文件夹,并在include中添加get_template_directory_uri() 。 它可能看起来像这样: include( get_template_directory_uri() . '/mail.php'); 这些函数的作用是确保包含文件,无论它们与 ...对不起,迟到的回答这是我的解决方案,这有助于我希望这将有助于其他人。 function userpage_rewrite_catch() { global $wp_query; if ( array_key_exists( 'ebooks_id', $wp_query->query_vars ) ) { include WP_PLUGIN_DIR .'/'. plugin_basename( dirname(__FILE__) ) .'/single-ebook.php'; exi ...相关文章
更多- Oracle优化配置指南(4)-Oracle的优化器
- HBase在淘宝的应用和优化小结
- hbase在淘宝的应用和优化小结
- Storm JVM 参数优化
- 为何转到JDK1.6后,不能支持中文了
- java WHILE 循环问题
- 安卓版的模拟地理定位器(无限制标点和无限循环)
- 转:HBase在淘宝的应用和优化小结
- Storm编译打包过程中遇到的一些问题及解决方法
- redhat6.4安装storm集群-4节点
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。