CommonSize | Android通用屏幕适配方案
kandi X-RAY | CommonSize Summary
kandi X-RAY | CommonSize Summary
Android通用屏幕适配方案
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- write content .
- Main entry point .
- Copy file to destination
- Parses a sw list of sws from a file .
- Parse output configuration
- Copies a directory .
- generate the module name
- Initialize the tv .
- Gets a blank string .
- Apply the text size to a text view .
CommonSize Key Features
CommonSize Examples and Code Snippets
# 输出配置,格式为w*n,其中w为参考宽度,美工的图给多少就填多少,n为dimen资源文件中,dimen条目的个数
# 输出配置可以填多个,分别以英文逗号,隔开
output_config=750*1000,750*1334,1080*1920
# 模块名字规则,{w}为上面的参考宽度,{n}为上面的条目数目
module_name_reg=common_size_w{w}_n{n}
# 缩进空格长度
intent_length=4
# 正数尺寸文件名
normal_file_name=nor
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
// 随便选一个,没有就按照下面配置重新生成自己要的
// 公司美工喜欢做iphone(750*1334)的图,就任意选一个w750的就行了
// 本人所在公司的广告机项目做的图是1080P的,所以有个w1080的配置
// 获取最小宽度的代码
Configuration config = getResources().getConfiguration();
int smallestScreenWidthDp = config.smallestScreenWidthDp;
Community Discussions
Trending Discussions on CommonSize
QUESTION
TLDR: When using more recent versions of
data.table
that use auto-indexing, is there any benefit from using%chin%
to subset a data.table on character columns?
In the past, using %chin%
from data.table
in place of %in%
when subsetting on character vectors resulted in a significant speed-up. In newer versions of data.table
, secondary indices are automatically created on non-key columns when sub-setting. The creation and usage of these indices appears to make any speed difference between %chin%
and %in%
irrelevant.
Going forward, are there any cases where using %chin%
to subset a data.table will still improve speed, or can I just use %in%
in the future?
Update: The conversation on PR#2494: Better subsetting optimization for compound queries seems to support an understanding that when evaluated in the data.table calling environment, the execution methods of %chin%
have been fundamentally changed.
For cases where the column used to subset the table more than once, performance will be drastically increased by auto-indexing, but when only used a single time (and thus not benefiting from the time spent generating the index), turning auto-indexing off will sometimes give marginally faster results.
I'll leave this open for a couple days, but I may flesh this out into an answer for the sake of posterity.
Data Generation and BenchmarkingThe data generated is made up of a randomly ordered combination of two unbalanced samples:
- 10 million single character strings, 26 possible unique values
- 1 million four character strings, 456,976 possible unique values
The intent here is to be representative of non-normal variables that are dominated by a few common values, but have numerous less common possibilities.
...ANSWER
Answered 2018-Jul-31 at 16:13Providing an answer here for the sake of closure: I've done my best to skim through the relevant commits on Github, but there's certainly a possibility I'm missing some of the finer nuances. If any of the contributors would like to make some clarifications, I'd be happy to update here.
The conversation on PR#2494: Better subsetting optimization for compound queries seems to support an understanding that when evaluated in the data.table calling environment, the execution methods of %chin%
have been fundamentally changed.
When sub-setting a
data.table
in cases where the same column will be used to subset the table multiple times, performance can be drastically increased by auto-indexing, so stick with the default options:options(datatable.auto.index = TRUE)
andoptions(datatable.use.index = TRUE)
. In this case, using%chin%
will not result in any performance improvement.If performance is critical and you know that you will only be sub-setting on a given column a single time (and thus not benefiting from the time spent generating the index), turning auto-indexing off with
options(datatable.auto.index = FALSE)
and can give marginally faster results. You can still manually create indexes and keys as always if you will be performing repetitive subsets, but the burden of optimization will rest on the user to make appropriate use ofsetkey()
andsetindex()
. When auto-indexing is turned off, using%chin%
will be faster than%in%
.When testing whether an element is present in a character vector outside of the
data.table
calling environment ,%chin%
is still faster than%in%
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install CommonSize
You can use CommonSize like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the CommonSize component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page