首页 \ 问答 \ 编译F#报价:性能?(Compiling an F# quotation: performance?)

编译F#报价:性能?(Compiling an F# quotation: performance?)

我有一个我操纵的F#引用(我在任何地方添加对象池来回收经常创建和删除的短期对象)。 我想运行结果报价; 现在我已经使用了F#PowerPack,它提供了将引用转换为表达式树的方法,以及我运行的委托。 无法访问生成的代码,我想知道:

- 编译代码的性能如何? 是否有一些未被删除的反射层或者它是真正的编译?

  • 我可以看到生成的代码并使用.Net Reflector吗?

谢谢 :)


I have an F# quotation that I manipulate (I add object pools everywhere to recycle short lived objects that get created and deleted very often). I would like to run the resulting quotation; for now I have used the F# PowerPack which offers methods to convert a quotation to an expression tree and the to a delegate, which I run. Having no access to the generated code, I was wondering:

-what is the performance of the compiled code? Is there some layer of reflection that is not removed or is it a true compilation?

  • can I see the generated code and use .Net Reflector on it?

thanks :)


原文:https://stackoverflow.com/questions/3529657
更新时间:2023-10-26 21:10

最满意答案

有一个UIPickerViewDelegate方法,每次滚动选择器时基本上都会触发该方法

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component

设置选择器的委托,实现此方法,看看会发生什么......

[编辑]好了,我现在明白了你的需求。 实现一个计时器,检查选择器的状态。

checkTimer = [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(checkPicker) userInfo:nil repeats:YES];

在上面的委托方法中,存储上次移动选择器的时间。

lastPickerDate = [[NSDate date] retain];

在checkPicker方法中检查从上次移动开始经过的时间

NSTimeInterval timeSinceMove = -[lastPickerDate timeIntervalSinceNow];

如果timeSinceMove大于某个所需的值,即0.5秒,则将BOOL pickerMoving设置为false。 否则将其设置为true。 这不是检查运动的最精确方法,但我认为应该做的工作......


There is a UIPickerViewDelegate method which is basically triggered every time you scroll the picker

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component

Set the delegate for your picker, implement this method and see what happens...

[EDIT] ok now I understand what you need. Implement a timer which checks the state of the picker.

checkTimer = [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(checkPicker) userInfo:nil repeats:YES];

in the above delegate method, store the last time the picker had been moved.

lastPickerDate = [[NSDate date] retain];

in the checkPicker method check how much time had elapsed from the last move

NSTimeInterval timeSinceMove = -[lastPickerDate timeIntervalSinceNow];

if timeSinceMove is bigger then some desired value i.e. 0.5 seconds, set your BOOL pickerMoving to false. else set it to true. This is not the most precise method to check for movement, but I think it should do the job...

相关问答

更多
  • viewDidLoad即将推出。 您必须等到视图布局发生之后。 尝试在viewDidAppear中设置contentSize。 你在使用自动布局吗? 如果是这样,请检查以下答案(并忘记1.): UIScrollView不使用自动布局约束 。 viewDidLoad is to soon. You must wait until after the layout of the views has taken place. Try setting the contentSize in viewDidAppear ...
  • 这是一种启动视差背景的超级简单方法。 与滑行! 我希望它能帮助您理解基础知识,然后再采用更难但更有效的编码方式。 因此,我将从获得背景移动的代码开始,然后尝试复制要放置在场景中的前景或对象的代码。 //declare ground picture. If Your putting this image over the top of another image (use a png file). var groundImage = SKTexture(imageNamed: "background. ...
  • 使用KVO观察集合视图的contentOffset 。 如果它位于滚动应停止的位置(或范围),请将contentOffset设置为动画。 Observe with KVO the contentOffset of the collection view. And if it's at the position (or range) where the scrolling should stop, set the contentOffset animated.
  • 检查MouseEventArgs的Delta属性: 示例代码: Private Sub Form1_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel If e.Delta > 0 Then Trace.WriteLine("Scrolled up!") Else Trace.WriteLine("Scr ...
  • 滚动行为设置为仅在以下位置使用: https://indianashrm.staging.wpengine.com/job-board/#createjobposting : https://indianashrm.staging.wpengine.com/job-board/#createjobposting 和#createjobposting表单不在加载的页面中( https://indianashrm.staging.wpengine.com/job-board/graphic-designer/ ...
  • 有一个UIPickerViewDelegate方法,每次滚动选择器时基本上都会触发该方法 - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component 设置选择器的委托,实现此方法,看看会发生什么...... [编辑]好了,我现在明白了你的需求。 实现一个计时器,检查选择器的状态。 checkTimer = [NSTimer scheduled ...
  • 它很容易..例如使用jquery,你可以在.scroll()内调用一个函数,只要你开始滚动就触发......只需从顶部或底部使用.offset()你就可以找到你想要的任何你想要的东西 its easy.. for example with jquery you can call a function within .scroll() triggering whenever you start scrolling... just use .offset() from top or bottom and you ...
  • 看到你的xib并检查这些东西。参见下图 try this this will clear your problem self.myTableView.bounces = YES; more info check this post
  • scroll: 'no' 不是有效的CSS属性。 众所周知,IE存在iFrames和CSS overflow属性的问题。 请查看此页面以获取解决方法: http : //www.webmasterworld.com/html/3113793.htm 或者这个: http : //www.codingforums.com/showthread.php?t = 107457 真的,这里最好的解决方案是在你的iFrame标签里面使用scrolling="no" 。 确实,它不符合W3标准 - 但没有客户会因为有 ...
  • 这可能不是您希望的答案,但是无法在UITest中获取UIPickerView中所有行的标题。 如您所知,在运行UITest时,您只能通过XCUIElement类访问应用程序的UI元素。 该类有一个value属性,可以为您提供有关您访问的UI元素的一些信息。 访问UIPickerView该value会为您提供当前所选行的标题。 但只有选定的行。 您可以访问选择器的行元素,但不幸的是,行元素的value属性始终为空。 所以,这里没有运气。 您可以获得的所有信息都是拣货员的行数。 但这并不奇怪。 即使您有权访问U ...

相关文章

更多

最新问答

更多
  • 获取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的基本操作命令。。。